package com.sw.study.presisence.sqlsession.sessionfactory.impl;

import com.sw.study.presisence.pojo.Configuration;
import com.sw.study.presisence.sqlsession.sessionfactory.SqlSession;
import com.sw.study.presisence.sqlsession.sessionfactory.SqlSessionFactory;

/**
 * Created by sw on 2020/3/25.
 */
public class DefaultSqlSessionFactory implements SqlSessionFactory {
    /**
     * 传入db信息
     */
    private Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    /**
     * 创建sqlSession
     * @return
     */
    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(configuration);
    }
}